import socket
sk=socket.socket()
sk.connect(('127.0.0.1',9001))

while True:
    msg=sk.recv(1024).decode('utf-8')
    print(msg)
    if msg.upper()=='Q':break
    send_msg=input('>>>')

    sk.send(send_msg.encode('utf-8'))
    if send_msg.upper()=='Q':break

sk.close()

# str -encode('utf-8')-> bytes
# str -encode('gbk')-> bytes
# '你' 字符
# utf-8  b'181921'      b'181921' -decode('utf-8')-> 你
# gbk    b'17210'       b'17210'  -decode('gbk')  -> 你

# 基于tcp协议的文件传输









